package com.example.administrator.daydayappmarket.software.choice.model;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lenovo on 2016/12/26.
 */

public class SoftwareChoiceTopicItem extends SoftwareChoiceParent {

    private String topic_name;
    private String topic_title;
    private String title_color;
    private List<SoftwareChoiceTopicApps> apps;

    @Override
    public void parseJson(JSONObject jsonObject) throws JSONException {
        if (jsonObject != null) {
            theme_type=jsonObject.getString("theme_type");
            JSONObject jsonObject1=jsonObject.getJSONObject("data");
            topic_name=jsonObject1.getString("topic_name");
            topic_title=jsonObject1.getString("topic_title");
            title_color=jsonObject1.getString("title_color");
            JSONArray jsonArray=jsonObject1.getJSONArray("apps");
            apps=new ArrayList<>();
            for (int i = 0; i < jsonArray.length(); i++) {
                JSONObject jsonObject2=jsonArray.getJSONObject(i);
                SoftwareChoiceTopicApps softwareChoiceTopicApps=new SoftwareChoiceTopicApps();
                softwareChoiceTopicApps.parseJson(jsonObject2);
                apps.add(softwareChoiceTopicApps);
            }
        }

    }

    public String getTopic_name() {
        return topic_name;
    }

    public String getTopic_title() {
        return topic_title;
    }

    public String getTitle_color() {
        return title_color;
    }

    public List<SoftwareChoiceTopicApps> getApps() {
        return apps;
    }
}
